<template>
  <el-dialog
    :title="dialogObj.title"
    append-to-body
    :visible.sync="dialogObj.show"
    :close-on-click-modal="false"
    width="700px"
  >
    <el-form
      ref="form"
      :model="form"
      label-width="120px"
      :disabled="dialogObj.read"
      v-if="dialogObj.show"
      status-icon
    >
      <el-row>
        <el-col :span="24">
          <el-form-item label="客户：" prop="customerName">
            <el-input
              v-model="form.customerName"
              style="width:530px;"
              size="mini"
              maxlength="200"
              :disabled="dialogObj.id != ''"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="专利名：" prop="title">
            <el-input
              v-model="form.title"
              style="width:530px;"
              size="mini"
              maxlength="200"
              :disabled="dialogObj.id != ''"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="专利申请号：" prop="applicationNumber">
            <el-input
              v-model="form.applicationNumber"
              style="width:200px;"
              size="mini"
              maxlength="50"
              :disabled="dialogObj.id != ''"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="申请日：" prop="applicationDatetime">
            <el-date-picker
              v-model="form.applicationDatetime"
              style="width:200px;"
              size="mini"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="缴费类型：" prop="feeType">
            <el-input
              v-model="form.feeType"
              style="width:200px;"
              size="mini"
              maxlength="50"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="应缴金额(元)：" prop="feeAmount">
            <el-input
              v-model="form.feeAmount"
              style="width:200px;"
              size="mini"
              maxlength="50"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="缴费截止日：" prop="expiryDate">
            <el-date-picker
              v-model="form.expiryDate"
              style="width:200px;"
              size="mini"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="客户缴纳日期：" prop="payTime">
            <el-date-picker
              v-model="form.payTime"
              style="width:200px;"
              size="mini"
              format="yyyy-MM-dd"
              value-format="yyyy-MM-dd"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="应交滞纳金额(元)：" prop="overdueAmount">
            <el-input
              v-model="form.overdueAmount"
              style="width:200px;"
              size="mini"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="代理费金额(元)：" prop="payName">
            <el-input
              v-model="form.agentAmount"
              style="width:200px;"
              size="mini"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="12">
          <el-form-item label="缴费人姓名：" prop="payName">
            <el-input
              v-model="form.payName"
              style="width:200px;"
              size="mini"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col> -->
      </el-row>
      <el-row>
        <el-col :span="12">
          <el-form-item label="其他费用金额(元)：" prop="overdueAmount">
            <el-input
              v-model="form.otherAmount"
              style="width:200px;"
              size="mini"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="备注：" prop="payName">
            <el-input
              v-model="form.remark"
              style="width:200px;"
              size="mini"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col>
        <!-- <el-col :span="12">
          <el-form-item label="缴费人姓名：" prop="payName">
            <el-input
              v-model="form.payName"
              style="width:200px;"
              size="mini"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col> -->
      </el-row>
      <!-- <el-row>
        <el-col :span="12">
          <el-form-item label="票据代码：" prop="billCode">
            <el-input
              v-model="form.billCode"
              style="width:200px;"
              size="mini"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="票据号码（收据号）：" prop="billNumber">
            <el-input
              v-model="form.billNumber"
              style="width:200px;"
              size="mini"
              maxlength="100"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row> -->
    </el-form>
    <span slot="footer" class="dialog-footer" v-if="!dialogObj.read">
      <el-button @click="dialogObj.show = false" size="mini">关 闭</el-button>
    </span>
  </el-dialog>
</template>
<script>
import { PATENTTYPELIST } from "@u/wordbook";
import timeFormat from "@u/timeFormat";
export default {
  name: "dialogCom",
  props: ["dialogObj"],
  data() {
    return {
      agentStatus: true,
      isUpdate: false,
      tableData: [
        {
          legalDatetime: "",
          legalInfo: "",
          legalDesc: ""
        }
      ],
      form: {
        id: "",
        customerName: "",
        title: "",
        applicationNumber: "",
        applicationDatetime: "",
        feeType: "",
        feeAmount: "",
        expiryDate: "",
        overdueAmount: "",
        payName: "",
        billCode: "",
        billNumber: "",
        agentAmount: "",
        otherAmount: "",
        remark: "",
        payTime: "",
        status: ""
      },
      patentTypeList: PATENTTYPELIST,
      customerList: []
    };
  },
  methods: {
    initDialog() {
      if (this.dialogObj.id) {
        this.form.id = this.dialogObj.id;
        this.form.customerName = this.dialogObj.form.customerName;
        this.form.title = this.dialogObj.form.title;
        this.form.applicationNumber = this.dialogObj.form.applicationNumber;
        this.form.applicationDatetime = this.dialogObj.form.applicationDatetime;
        this.form.feeType = this.dialogObj.form.feeType;
        this.form.feeAmount = timeFormat.formatFloat(
          this.dialogObj.form.feeAmount / 100,
          2
        );
        this.form.expiryDate = this.dialogObj.form.expiryDate;
        this.form.overdueAmount = timeFormat.formatFloat(
          this.dialogObj.form.overdueAmount / 100,
          2
        );
        this.form.payName = this.dialogObj.form.payName;
        this.form.billCode = this.dialogObj.form.billCode;
        this.form.billNumber = this.dialogObj.form.billNumber;
        this.form.agentAmount = timeFormat.formatFloat(
          this.dialogObj.form.agentAmount / 100,
          2
        );
        this.form.payTime = this.dialogObj.form.payTime;
        this.form.otherAmount = timeFormat.formatFloat(
          this.dialogObj.form.otherAmount / 100,
          2
        );
        this.form.remark = this.dialogObj.form.remark;
      } else {
        this.form.customerName = "";
        this.form.title = "";
        this.form.applicationNumber = "";
        this.form.applicationDatetime = "";
        this.form.feeType = "";
        this.form.feeAmount = "";
        this.form.expiryDate = "";
        this.form.overdueAmount = "";
        this.form.payName = "";
        this.form.billCode = "";
        this.form.billNumber = "";
        this.form.agentAmount = "";
        this.form.payTime = "";
        this.form.otherAmount = "";
        this.form.remark = "";
      }
    }
  },
  watch: {
    "dialogObj.show"(val) {
      if (val) {
        this.initDialog();
      }
    }
  }
};
</script>
<style scoped lang="scss"></style>
